
import 'package:dingtalk/core/values/values.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

class THMessageTopQuick extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        Padding(
          padding: EdgeInsets.symmetric(vertical: kSize32),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: <Widget>[
              THTopQuickItem(
                  iconPath: "assets/icons/icon_calendar.svg",
                  title: "日历",
                  showDivider: true),
              THTopQuickItem(
                  iconPath: "assets/icons/icon_backlog.svg",
                  title: "待办",
                  showDivider: true),
              THTopQuickItem(
                  iconPath: "assets/icons/icon_ding.svg", title: "DING"),
            ],
          ),
        ),
        Divider(height: kSize1, color: kColorECEDED, indent: kSize36)
      ],
    );
  }
}

class THTopQuickItem extends StatelessWidget {
  final String iconPath;
  final String title;
  final bool showDivider;

  THTopQuickItem(
      {@required this.iconPath,
      @required this.title,
      this.showDivider = false});

  @override
  Widget build(BuildContext context) {
    return Row(
      children: <Widget>[
        SvgPicture.asset(
          iconPath,
          width: kSize38,
          height: kSize38,
          color: kColor99,
        ),
        Padding(
          padding: EdgeInsets.only(left: kSize14),
          child: Text(
            title,
            style: TextStyle(
              color: kColor99,
            ),
          ),
        ),
        Padding(
          padding: EdgeInsets.only(left: kSize16),
          child: Container(
              width: kSize32,
              height: kSize32,
              alignment: Alignment.topCenter,
              decoration: BoxDecoration(
                  color: Colors.red,
                  borderRadius: BorderRadius.circular(kSize20)),
              child: Text(
                "6",
                style: TextStyle(color: Colors.white, fontSize: kSize24),
              )),
        ),
        showDivider
            ? Container(
                width: kSize1,
                height: kSize38,
                margin: EdgeInsets.only(left: kSize56),
                color: kColorECEDED,
              )
            : SizedBox(),
      ],
    );
  }
}
